package br.com.fsa.aplication.Util;

import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;

import br.com.fsa.aplication.Model.NotaFiscalVO;

public class NFDataModel extends ListDataModel<NotaFiscalVO> implements SelectableDataModel<NotaFiscalVO> {

	public NFDataModel (List<NotaFiscalVO> data){
		super(data);
	}
	
	
	
	@Override
	public NotaFiscalVO getRowData(String arg0) {
		List<NotaFiscalVO> nfs = (List<NotaFiscalVO>) getWrappedData();  
        
        for(NotaFiscalVO nf : nfs) {  
            if(nf.getNfID().equals(arg0))  
                return nf;  
        }  
          
        return null; 
	}

	@Override
	public Object getRowKey(NotaFiscalVO arg0) {
		
		return arg0.getNfID();
	}

}

